
# Begin preamble

import ctypes, os, sys
from ctypes import *

_int_types = (c_int16, c_int32)
if hasattr(ctypes, 'c_int64'):
    _int_types += (c_int64,)
for t in _int_types:
    if sizeof(t) == sizeof(c_size_t):
        c_ptrdiff_t = t
del t
del _int_types

class c_void(Structure):
    _fields_ = [('dummy', c_int)]

def POINTER(obj):
    p = ctypes.POINTER(obj)

    if not isinstance(p.from_param, classmethod):
        def from_param(cls, x):
            if x is None:
                return cls()
            else:
                return x
        p.from_param = classmethod(from_param)

    return p

class UserString:
    def __init__(self, seq):
        if isinstance(seq, basestring):
            self.data = seq
        elif isinstance(seq, UserString):
            self.data = seq.data[:]
        else:
            self.data = str(seq)
    def __str__(self): return str(self.data)
    def __repr__(self): return repr(self.data)
    def __int__(self): return int(self.data)
    def __long__(self): return long(self.data)
    def __float__(self): return float(self.data)
    def __complex__(self): return complex(self.data)
    def __hash__(self): return hash(self.data)

    def __cmp__(self, string):
        if isinstance(string, UserString):
            return cmp(self.data, string.data)
        else:
            return cmp(self.data, string)
    def __contains__(self, char):
        return char in self.data

    def __len__(self): return len(self.data)
    def __getitem__(self, index): return self.__class__(self.data[index])
    def __getslice__(self, start, end):
        start = max(start, 0); end = max(end, 0)
        return self.__class__(self.data[start:end])

    def __add__(self, other):
        if isinstance(other, UserString):
            return self.__class__(self.data + other.data)
        elif isinstance(other, basestring):
            return self.__class__(self.data + other)
        else:
            return self.__class__(self.data + str(other))
    def __radd__(self, other):
        if isinstance(other, basestring):
            return self.__class__(other + self.data)
        else:
            return self.__class__(str(other) + self.data)
    def __mul__(self, n):
        return self.__class__(self.data*n)
    __rmul__ = __mul__
    def __mod__(self, args):
        return self.__class__(self.data % args)


    def capitalize(self): return self.__class__(self.data.capitalize())
    def center(self, width, *args):
        return self.__class__(self.data.center(width, *args))
    def count(self, sub, start=0, end=sys.maxint):
        return self.data.count(sub, start, end)
    def decode(self, encoding=None, errors=None): 
        if encoding:
            if errors:
                return self.__class__(self.data.decode(encoding, errors))
            else:
                return self.__class__(self.data.decode(encoding))
        else:
            return self.__class__(self.data.decode())
    def encode(self, encoding=None, errors=None): 
        if encoding:
            if errors:
                return self.__class__(self.data.encode(encoding, errors))
            else:
                return self.__class__(self.data.encode(encoding))
        else:
            return self.__class__(self.data.encode())
    def endswith(self, suffix, start=0, end=sys.maxint):
        return self.data.endswith(suffix, start, end)
    def expandtabs(self, tabsize=8):
        return self.__class__(self.data.expandtabs(tabsize))
    def find(self, sub, start=0, end=sys.maxint):
        return self.data.find(sub, start, end)
    def index(self, sub, start=0, end=sys.maxint):
        return self.data.index(sub, start, end)
    def isalpha(self): return self.data.isalpha()
    def isalnum(self): return self.data.isalnum()
    def isdecimal(self): return self.data.isdecimal()
    def isdigit(self): return self.data.isdigit()
    def islower(self): return self.data.islower()
    def isnumeric(self): return self.data.isnumeric()
    def isspace(self): return self.data.isspace()
    def istitle(self): return self.data.istitle()
    def isupper(self): return self.data.isupper()
    def join(self, seq): return self.data.join(seq)
    def ljust(self, width, *args):
        return self.__class__(self.data.ljust(width, *args))
    def lower(self): return self.__class__(self.data.lower())
    def lstrip(self, chars=None): return self.__class__(self.data.lstrip(chars))
    def partition(self, sep):
        return self.data.partition(sep)
    def replace(self, old, new, maxsplit=-1):
        return self.__class__(self.data.replace(old, new, maxsplit))
    def rfind(self, sub, start=0, end=sys.maxint):
        return self.data.rfind(sub, start, end)
    def rindex(self, sub, start=0, end=sys.maxint):
        return self.data.rindex(sub, start, end)
    def rjust(self, width, *args):
        return self.__class__(self.data.rjust(width, *args))
    def rpartition(self, sep):
        return self.data.rpartition(sep)
    def rstrip(self, chars=None): return self.__class__(self.data.rstrip(chars))
    def split(self, sep=None, maxsplit=-1):
        return self.data.split(sep, maxsplit)
    def rsplit(self, sep=None, maxsplit=-1):
        return self.data.rsplit(sep, maxsplit)
    def splitlines(self, keepends=0): return self.data.splitlines(keepends)
    def startswith(self, prefix, start=0, end=sys.maxint):
        return self.data.startswith(prefix, start, end)
    def strip(self, chars=None): return self.__class__(self.data.strip(chars))
    def swapcase(self): return self.__class__(self.data.swapcase())
    def title(self): return self.__class__(self.data.title())
    def translate(self, *args):
        return self.__class__(self.data.translate(*args))
    def upper(self): return self.__class__(self.data.upper())
    def zfill(self, width): return self.__class__(self.data.zfill(width))

class MutableString(UserString):
    
    def __init__(self, string=""):
        self.data = string
    def __hash__(self):
        raise TypeError("unhashable type (it is mutable)")
    def __setitem__(self, index, sub):
        if index < 0:
            index += len(self.data)
        if index < 0 or index >= len(self.data): raise IndexError
        self.data = self.data[:index] + sub + self.data[index+1:]
    def __delitem__(self, index):
        if index < 0:
            index += len(self.data)
        if index < 0 or index >= len(self.data): raise IndexError
        self.data = self.data[:index] + self.data[index+1:]
    def __setslice__(self, start, end, sub):
        start = max(start, 0); end = max(end, 0)
        if isinstance(sub, UserString):
            self.data = self.data[:start]+sub.data+self.data[end:]
        elif isinstance(sub, basestring):
            self.data = self.data[:start]+sub+self.data[end:]
        else:
            self.data =  self.data[:start]+str(sub)+self.data[end:]
    def __delslice__(self, start, end):
        start = max(start, 0); end = max(end, 0)
        self.data = self.data[:start] + self.data[end:]
    def immutable(self):
        return UserString(self.data)
    def __iadd__(self, other):
        if isinstance(other, UserString):
            self.data += other.data
        elif isinstance(other, basestring):
            self.data += other
        else:
            self.data += str(other)
        return self
    def __imul__(self, n):
        self.data *= n
        return self

class String(MutableString, Union):

    _fields_ = [('raw', POINTER(c_char)),
                ('data', c_char_p)]

    def __init__(self, obj=""):
        if isinstance(obj, (str, unicode, UserString)):
            self.data = str(obj)
        else:
            self.raw = obj

    def __len__(self):
        return self.data and len(self.data) or 0

    def from_param(cls, obj):
        if obj is None or obj == 0:
            return cls(POINTER(c_char)())

        elif isinstance(obj, String):
            return obj

        elif isinstance(obj, str):
            return cls(obj)

        elif isinstance(obj, c_char_p):
            return obj

        elif isinstance(obj, POINTER(c_char)):
            return obj

        elif isinstance(obj, int):
            return cls(cast(obj, POINTER(c_char)))

        else:
            return String.from_param(obj._as_parameter_)
    from_param = classmethod(from_param)

def ReturnString(obj, func=None, arguments=None):
    return String.from_param(obj)

def UNCHECKED(type):
    if (hasattr(type, "_type_") and isinstance(type._type_, str)
        and type._type_ != "P"):
        return type
    else:
        return c_void_p


class _variadic_function(object):
    def __init__(self,func,restype,argtypes):
        self.func=func
        self.func.restype=restype
        self.argtypes=argtypes
    def _as_parameter_(self):

        return self.func
    def __call__(self,*args):
        fixed_args=[]
        i=0
        for argtype in self.argtypes:

            fixed_args.append(argtype.from_param(args[i]))
            i+=1
        return self.func(*fixed_args+list(args[i:]))

# End preamble

_libs = {}
_libdirs = []

# Begin loader



import os.path, re, sys, glob
import ctypes
import ctypes.util

def _environ_path(name):
    if name in os.environ:
        return os.environ[name].split(":")
    else:
        return []

class LibraryLoader(object):
    def __init__(self):
        self.other_dirs=[]

    def load_library(self,libname):
        paths = self.getpaths(libname)

        for path in paths:
            if os.path.exists(path):
                return self.load(path)

        raise ImportError("%s not found." % libname)

    def load(self,path):
        try:
            if sys.platform == 'darwin':
                return ctypes.CDLL(path, ctypes.RTLD_GLOBAL)
            else:
                return ctypes.cdll.LoadLibrary(path)
        except OSError,e:
            raise ImportError(e)

    def getpaths(self,libname):
        if os.path.isabs(libname):
            yield libname
        else:
            for path in self.getplatformpaths(libname):
                yield path

            path = ctypes.util.find_library(libname)
            if path: yield path

    def getplatformpaths(self, libname):
        return []


class DarwinLibraryLoader(LibraryLoader):
    name_formats = ["lib%s.dylib", "lib%s.so", "lib%s.bundle", "%s.dylib",
                "%s.so", "%s.bundle", "%s"]

    def getplatformpaths(self,libname):
        if os.path.pathsep in libname:
            names = [libname]
        else:
            names = [format % libname for format in self.name_formats]

        for dir in self.getdirs(libname):
            for name in names:
                yield os.path.join(dir,name)

    def getdirs(self,libname):
       

        dyld_fallback_library_path = _environ_path("DYLD_FALLBACK_LIBRARY_PATH")
        if not dyld_fallback_library_path:
            dyld_fallback_library_path = [os.path.expanduser('~/lib'),
                                          '/usr/local/lib', '/usr/lib']

        dirs = []

        if '/' in libname:
            dirs.extend(_environ_path("DYLD_LIBRARY_PATH"))
        else:
            dirs.extend(_environ_path("LD_LIBRARY_PATH"))
            dirs.extend(_environ_path("DYLD_LIBRARY_PATH"))

        dirs.extend(self.other_dirs)
        dirs.append(".")
        dirs.append(os.path.dirname(__file__))

        if hasattr(sys, 'frozen') and sys.frozen == 'macosx_app':
            dirs.append(os.path.join(
                os.environ['RESOURCEPATH'],
                '..',
                'Frameworks'))

        dirs.extend(dyld_fallback_library_path)

        return dirs



class PosixLibraryLoader(LibraryLoader):
    _ld_so_cache = None

    def _create_ld_so_cache(self):
        

        directories = []
        for name in ("LD_LIBRARY_PATH",
                     "SHLIB_PATH", 
                     "LIBPATH", 
                     "LIBRARY_PATH", 
                    ):
            if name in os.environ:
                directories.extend(os.environ[name].split(os.pathsep))
        directories.extend(self.other_dirs)
        directories.append(".")
        directories.append(os.path.dirname(__file__))

        try: directories.extend([dir.strip() for dir in open('/etc/ld.so.conf')])
        except IOError: pass

        directories.extend(['/lib', '/usr/lib', '/lib64', '/usr/lib64'])

        cache = {}
        lib_re = re.compile(r'lib(.*)\.s[ol]')
        ext_re = re.compile(r'\.s[ol]$')
        for dir in directories:
            try:
                for path in glob.glob("%s/*.s[ol]*" % dir):
                    file = os.path.basename(path)

                    if file not in cache:
                        cache[file] = path

                    match = lib_re.match(file)
                    if match:
                        library = match.group(1)
                        if library not in cache:
                            cache[library] = path
            except OSError:
                pass

        self._ld_so_cache = cache

    def getplatformpaths(self, libname):
        if self._ld_so_cache is None:
            self._create_ld_so_cache()

        result = self._ld_so_cache.get(libname)
        if result: yield result

        path = ctypes.util.find_library(libname)
        if path: yield os.path.join("/lib",path)


class _WindowsLibrary(object):
    def __init__(self, path):
        self.cdll = ctypes.cdll.LoadLibrary(path)
        self.windll = ctypes.windll.LoadLibrary(path)

    def __getattr__(self, name):
        try: return getattr(self.cdll,name)
        except AttributeError:
            try: return getattr(self.windll,name)
            except AttributeError:
                raise

class WindowsLibraryLoader(LibraryLoader):
    name_formats = ["%s.dll", "lib%s.dll", "%slib.dll"]

    def load_library(self, libname):
        try:
            result = LibraryLoader.load_library(self, libname)
        except ImportError:
            result = None
            if os.path.sep not in libname:
                for name in self.name_formats:
                    try:
                        result = getattr(ctypes.cdll, name % libname)
                        if result:
                            break
                    except WindowsError:
                        result = None
            if result is None:
                try:
                    result = getattr(ctypes.cdll, libname)
                except WindowsError:
                    result = None
            if result is None:
                raise ImportError("%s not found." % libname)
        return result

    def load(self, path):
        return _WindowsLibrary(path)

    def getplatformpaths(self, libname):
        if os.path.sep not in libname:
            for name in self.name_formats:
                dll_in_current_dir = os.path.abspath(name % libname)
                if os.path.exists(dll_in_current_dir):
                    yield dll_in_current_dir
                path = ctypes.util.find_library(name % libname)
                if path:
                    yield path



loaderclass = {
    "darwin":   DarwinLibraryLoader,
    "cygwin":   WindowsLibraryLoader,
    "win32":    WindowsLibraryLoader
}

loader = loaderclass.get(sys.platform, PosixLibraryLoader)()

def add_library_search_dirs(other_dirs):
    loader.other_dirs = other_dirs

load_library = loader.load_library

del loaderclass

# End loader

add_library_search_dirs([])

# Begin libraries

_libs["CoreFoundation"] = load_library("CoreFoundation")

# End libraries


Boolean = c_ubyte 

UInt8 = c_ubyte 

UInt32 = c_uint 

SInt32 = c_int 

UniChar = c_ushort 

StringPtr = POINTER(c_ubyte) 

ConstStringPtr = POINTER(c_ubyte) 

ConstStr255Param = POINTER(c_ubyte) 

CFTypeID = c_ulong 

CFOptionFlags = c_ulong 

CFIndex = c_long

CFTypeRef = POINTER(None) 

class struct___CFString(Structure):
    pass

CFStringRef = POINTER(struct___CFString) 

CFMutableStringRef = POINTER(struct___CFString) 

CFComparisonResult = CFIndex 

class struct_anon_3(Structure):
    pass

struct_anon_3.__slots__ = [
    'location',
    'length',
]
struct_anon_3._fields_ = [
    ('location', CFIndex),
    ('length', CFIndex),
]

CFRange = struct_anon_3 


class struct___CFAllocator(Structure):
    pass

CFAllocatorRef = POINTER(struct___CFAllocator) 


class struct___CFArray(Structure):
    pass

CFArrayRef = POINTER(struct___CFArray) 


class struct___CFData(Structure):
    pass

CFDataRef = POINTER(struct___CFData) 


class struct___CFDictionary(Structure):
    pass

CFDictionaryRef = POINTER(struct___CFDictionary) 


class struct___CFCharacterSet(Structure):
    pass

CFCharacterSetRef = POINTER(struct___CFCharacterSet) 


class struct___CFLocale(Structure):
    pass

CFLocaleRef = POINTER(struct___CFLocale) 

CFStringEncoding = UInt32 

enum_anon_9 = c_int 

kCFStringEncodingMacRoman = 0 

kCFStringEncodingWindowsLatin1 = 1280 

kCFStringEncodingISOLatin1 = 513 

kCFStringEncodingNextStepLatin = 2817 

kCFStringEncodingASCII = 1536 

kCFStringEncodingUnicode = 256

kCFStringEncodingUTF8 = 134217984 

kCFStringEncodingNonLossyASCII = 3071 

kCFStringEncodingUTF16 = 256 

kCFStringEncodingUTF16BE = 268435712 

kCFStringEncodingUTF16LE = 335544576 

kCFStringEncodingUTF32 = 201326848 

kCFStringEncodingUTF32BE = 402653440 

kCFStringEncodingUTF32LE = 469762304 

CFStringBuiltInEncodings = CFStringEncoding


if hasattr(_libs['CoreFoundation'], 'CFStringGetTypeID'):
    CFStringGetTypeID = _libs['CoreFoundation'].CFStringGetTypeID
    CFStringGetTypeID.argtypes = []
    CFStringGetTypeID.restype = CFTypeID


if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithPascalString'):
    CFStringCreateWithPascalString = _libs['CoreFoundation'].CFStringCreateWithPascalString
    CFStringCreateWithPascalString.argtypes = [CFAllocatorRef, ConstStr255Param, CFStringEncoding]
    CFStringCreateWithPascalString.restype = CFStringRef


if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithCString'):
    CFStringCreateWithCString = _libs['CoreFoundation'].CFStringCreateWithCString
    CFStringCreateWithCString.argtypes = [CFAllocatorRef, String, CFStringEncoding]
    CFStringCreateWithCString.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithBytes'):
    CFStringCreateWithBytes = _libs['CoreFoundation'].CFStringCreateWithBytes
    CFStringCreateWithBytes.argtypes = [CFAllocatorRef, POINTER(UInt8), CFIndex, CFStringEncoding, Boolean]
    CFStringCreateWithBytes.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithCharacters'):
    CFStringCreateWithCharacters = _libs['CoreFoundation'].CFStringCreateWithCharacters
    CFStringCreateWithCharacters.argtypes = [CFAllocatorRef, POINTER(UniChar), CFIndex]
    CFStringCreateWithCharacters.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithPascalStringNoCopy'):
    CFStringCreateWithPascalStringNoCopy = _libs['CoreFoundation'].CFStringCreateWithPascalStringNoCopy
    CFStringCreateWithPascalStringNoCopy.argtypes = [CFAllocatorRef, ConstStr255Param, CFStringEncoding, CFAllocatorRef]
    CFStringCreateWithPascalStringNoCopy.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithCStringNoCopy'):
    CFStringCreateWithCStringNoCopy = _libs['CoreFoundation'].CFStringCreateWithCStringNoCopy
    CFStringCreateWithCStringNoCopy.argtypes = [CFAllocatorRef, String, CFStringEncoding, CFAllocatorRef]
    CFStringCreateWithCStringNoCopy.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithBytesNoCopy'):
    CFStringCreateWithBytesNoCopy = _libs['CoreFoundation'].CFStringCreateWithBytesNoCopy
    CFStringCreateWithBytesNoCopy.argtypes = [CFAllocatorRef, POINTER(UInt8), CFIndex, CFStringEncoding, Boolean, CFAllocatorRef]
    CFStringCreateWithBytesNoCopy.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithCharactersNoCopy'):
    CFStringCreateWithCharactersNoCopy = _libs['CoreFoundation'].CFStringCreateWithCharactersNoCopy
    CFStringCreateWithCharactersNoCopy.argtypes = [CFAllocatorRef, POINTER(UniChar), CFIndex, CFAllocatorRef]
    CFStringCreateWithCharactersNoCopy.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithSubstring'):
    CFStringCreateWithSubstring = _libs['CoreFoundation'].CFStringCreateWithSubstring
    CFStringCreateWithSubstring.argtypes = [CFAllocatorRef, CFStringRef, CFRange]
    CFStringCreateWithSubstring.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateCopy'):
    CFStringCreateCopy = _libs['CoreFoundation'].CFStringCreateCopy
    CFStringCreateCopy.argtypes = [CFAllocatorRef, CFStringRef]
    CFStringCreateCopy.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithFormat'):
    _func = _libs['CoreFoundation'].CFStringCreateWithFormat
    _restype = CFStringRef
    _argtypes = [CFAllocatorRef, CFDictionaryRef, CFStringRef]
    CFStringCreateWithFormat = _variadic_function(_func,_restype,_argtypes)

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithFormatAndArguments'):
    CFStringCreateWithFormatAndArguments = _libs['CoreFoundation'].CFStringCreateWithFormatAndArguments
    CFStringCreateWithFormatAndArguments.argtypes = [CFAllocatorRef, CFDictionaryRef, CFStringRef, c_void_p]
    CFStringCreateWithFormatAndArguments.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateMutable'):
    CFStringCreateMutable = _libs['CoreFoundation'].CFStringCreateMutable
    CFStringCreateMutable.argtypes = [CFAllocatorRef, CFIndex]
    CFStringCreateMutable.restype = CFMutableStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateMutableCopy'):
    CFStringCreateMutableCopy = _libs['CoreFoundation'].CFStringCreateMutableCopy
    CFStringCreateMutableCopy.argtypes = [CFAllocatorRef, CFIndex, CFStringRef]
    CFStringCreateMutableCopy.restype = CFMutableStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateMutableWithExternalCharactersNoCopy'):
    CFStringCreateMutableWithExternalCharactersNoCopy = _libs['CoreFoundation'].CFStringCreateMutableWithExternalCharactersNoCopy
    CFStringCreateMutableWithExternalCharactersNoCopy.argtypes = [CFAllocatorRef, POINTER(UniChar), CFIndex, CFIndex, CFAllocatorRef]
    CFStringCreateMutableWithExternalCharactersNoCopy.restype = CFMutableStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringGetLength'):
    CFStringGetLength = _libs['CoreFoundation'].CFStringGetLength
    CFStringGetLength.argtypes = [CFStringRef]
    CFStringGetLength.restype = CFIndex

if hasattr(_libs['CoreFoundation'], 'CFStringGetCharacterAtIndex'):
    CFStringGetCharacterAtIndex = _libs['CoreFoundation'].CFStringGetCharacterAtIndex
    CFStringGetCharacterAtIndex.argtypes = [CFStringRef, CFIndex]
    CFStringGetCharacterAtIndex.restype = UniChar

if hasattr(_libs['CoreFoundation'], 'CFStringGetCharacters'):
    CFStringGetCharacters = _libs['CoreFoundation'].CFStringGetCharacters
    CFStringGetCharacters.argtypes = [CFStringRef, CFRange, POINTER(UniChar)]
    CFStringGetCharacters.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringGetPascalString'):
    CFStringGetPascalString = _libs['CoreFoundation'].CFStringGetPascalString
    CFStringGetPascalString.argtypes = [CFStringRef, StringPtr, CFIndex, CFStringEncoding]
    CFStringGetPascalString.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringGetCString'):
    CFStringGetCString = _libs['CoreFoundation'].CFStringGetCString
    CFStringGetCString.argtypes = [CFStringRef, String, CFIndex, CFStringEncoding]
    CFStringGetCString.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringGetPascalStringPtr'):
    CFStringGetPascalStringPtr = _libs['CoreFoundation'].CFStringGetPascalStringPtr
    CFStringGetPascalStringPtr.argtypes = [CFStringRef, CFStringEncoding]
    CFStringGetPascalStringPtr.restype = ConstStringPtr

if hasattr(_libs['CoreFoundation'], 'CFStringGetCStringPtr'):
    CFStringGetCStringPtr = _libs['CoreFoundation'].CFStringGetCStringPtr
    CFStringGetCStringPtr.argtypes = [CFStringRef, CFStringEncoding]
    if sizeof(c_int) == sizeof(c_void_p):
        CFStringGetCStringPtr.restype = ReturnString
    else:
        CFStringGetCStringPtr.restype = String
        CFStringGetCStringPtr.errcheck = ReturnString

if hasattr(_libs['CoreFoundation'], 'CFStringGetCharactersPtr'):
    CFStringGetCharactersPtr = _libs['CoreFoundation'].CFStringGetCharactersPtr
    CFStringGetCharactersPtr.argtypes = [CFStringRef]
    CFStringGetCharactersPtr.restype = POINTER(UniChar)

if hasattr(_libs['CoreFoundation'], 'CFStringGetBytes'):
    CFStringGetBytes = _libs['CoreFoundation'].CFStringGetBytes
    CFStringGetBytes.argtypes = [CFStringRef, CFRange, CFStringEncoding, UInt8, Boolean, POINTER(UInt8), CFIndex, POINTER(CFIndex)]
    CFStringGetBytes.restype = CFIndex

if hasattr(_libs['CoreFoundation'], 'CFStringCreateFromExternalRepresentation'):
    CFStringCreateFromExternalRepresentation = _libs['CoreFoundation'].CFStringCreateFromExternalRepresentation
    CFStringCreateFromExternalRepresentation.argtypes = [CFAllocatorRef, CFDataRef, CFStringEncoding]
    CFStringCreateFromExternalRepresentation.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateExternalRepresentation'):
    CFStringCreateExternalRepresentation = _libs['CoreFoundation'].CFStringCreateExternalRepresentation
    CFStringCreateExternalRepresentation.argtypes = [CFAllocatorRef, CFStringRef, CFStringEncoding, UInt8]
    CFStringCreateExternalRepresentation.restype = CFDataRef

if hasattr(_libs['CoreFoundation'], 'CFStringGetSmallestEncoding'):
    CFStringGetSmallestEncoding = _libs['CoreFoundation'].CFStringGetSmallestEncoding
    CFStringGetSmallestEncoding.argtypes = [CFStringRef]
    CFStringGetSmallestEncoding.restype = CFStringEncoding

if hasattr(_libs['CoreFoundation'], 'CFStringGetFastestEncoding'):
    CFStringGetFastestEncoding = _libs['CoreFoundation'].CFStringGetFastestEncoding
    CFStringGetFastestEncoding.argtypes = [CFStringRef]
    CFStringGetFastestEncoding.restype = CFStringEncoding

if hasattr(_libs['CoreFoundation'], 'CFStringGetSystemEncoding'):
    CFStringGetSystemEncoding = _libs['CoreFoundation'].CFStringGetSystemEncoding
    CFStringGetSystemEncoding.argtypes = []
    CFStringGetSystemEncoding.restype = CFStringEncoding

if hasattr(_libs['CoreFoundation'], 'CFStringGetMaximumSizeForEncoding'):
    CFStringGetMaximumSizeForEncoding = _libs['CoreFoundation'].CFStringGetMaximumSizeForEncoding
    CFStringGetMaximumSizeForEncoding.argtypes = [CFIndex, CFStringEncoding]
    CFStringGetMaximumSizeForEncoding.restype = CFIndex

if hasattr(_libs['CoreFoundation'], 'CFStringGetFileSystemRepresentation'):
    CFStringGetFileSystemRepresentation = _libs['CoreFoundation'].CFStringGetFileSystemRepresentation
    CFStringGetFileSystemRepresentation.argtypes = [CFStringRef, String, CFIndex]
    CFStringGetFileSystemRepresentation.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringGetMaximumSizeOfFileSystemRepresentation'):
    CFStringGetMaximumSizeOfFileSystemRepresentation = _libs['CoreFoundation'].CFStringGetMaximumSizeOfFileSystemRepresentation
    CFStringGetMaximumSizeOfFileSystemRepresentation.argtypes = [CFStringRef]
    CFStringGetMaximumSizeOfFileSystemRepresentation.restype = CFIndex

if hasattr(_libs['CoreFoundation'], 'CFStringCreateWithFileSystemRepresentation'):
    CFStringCreateWithFileSystemRepresentation = _libs['CoreFoundation'].CFStringCreateWithFileSystemRepresentation
    CFStringCreateWithFileSystemRepresentation.argtypes = [CFAllocatorRef, String]
    CFStringCreateWithFileSystemRepresentation.restype = CFStringRef

enum_anon_10 = c_int 

kCFCompareCaseInsensitive = 1 

kCFCompareBackwards = 4 

kCFCompareAnchored = 8 

kCFCompareNonliteral = 16 

kCFCompareLocalized = 32 

kCFCompareNumerically = 64

kCFCompareDiacriticInsensitive = 128 

kCFCompareWidthInsensitive = 256 

kCFCompareForcedOrdering = 512 

CFStringCompareFlags = CFOptionFlags 


if hasattr(_libs['CoreFoundation'], 'CFStringCompareWithOptionsAndLocale'):
    CFStringCompareWithOptionsAndLocale = _libs['CoreFoundation'].CFStringCompareWithOptionsAndLocale
    CFStringCompareWithOptionsAndLocale.argtypes = [CFStringRef, CFStringRef, CFRange, CFOptionFlags, CFLocaleRef]
    CFStringCompareWithOptionsAndLocale.restype = CFComparisonResult

if hasattr(_libs['CoreFoundation'], 'CFStringCompareWithOptions'):
    CFStringCompareWithOptions = _libs['CoreFoundation'].CFStringCompareWithOptions
    CFStringCompareWithOptions.argtypes = [CFStringRef, CFStringRef, CFRange, CFOptionFlags]
    CFStringCompareWithOptions.restype = CFComparisonResult

if hasattr(_libs['CoreFoundation'], 'CFStringCompare'):
    CFStringCompare = _libs['CoreFoundation'].CFStringCompare
    CFStringCompare.argtypes = [CFStringRef, CFStringRef, CFOptionFlags]
    CFStringCompare.restype = CFComparisonResult

if hasattr(_libs['CoreFoundation'], 'CFStringFindWithOptionsAndLocale'):
    CFStringFindWithOptionsAndLocale = _libs['CoreFoundation'].CFStringFindWithOptionsAndLocale
    CFStringFindWithOptionsAndLocale.argtypes = [CFStringRef, CFStringRef, CFRange, CFOptionFlags, CFLocaleRef, POINTER(CFRange)]
    CFStringFindWithOptionsAndLocale.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringFindWithOptions'):
    CFStringFindWithOptions = _libs['CoreFoundation'].CFStringFindWithOptions
    CFStringFindWithOptions.argtypes = [CFStringRef, CFStringRef, CFRange, CFOptionFlags, POINTER(CFRange)]
    CFStringFindWithOptions.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringCreateArrayWithFindResults'):
    CFStringCreateArrayWithFindResults = _libs['CoreFoundation'].CFStringCreateArrayWithFindResults
    CFStringCreateArrayWithFindResults.argtypes = [CFAllocatorRef, CFStringRef, CFStringRef, CFRange, CFOptionFlags]
    CFStringCreateArrayWithFindResults.restype = CFArrayRef

if hasattr(_libs['CoreFoundation'], 'CFStringFind'):
    CFStringFind = _libs['CoreFoundation'].CFStringFind
    CFStringFind.argtypes = [CFStringRef, CFStringRef, CFOptionFlags]
    CFStringFind.restype = CFRange

if hasattr(_libs['CoreFoundation'], 'CFStringHasPrefix'):
    CFStringHasPrefix = _libs['CoreFoundation'].CFStringHasPrefix
    CFStringHasPrefix.argtypes = [CFStringRef, CFStringRef]
    CFStringHasPrefix.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringHasSuffix'):
    CFStringHasSuffix = _libs['CoreFoundation'].CFStringHasSuffix
    CFStringHasSuffix.argtypes = [CFStringRef, CFStringRef]
    CFStringHasSuffix.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringGetRangeOfComposedCharactersAtIndex'):
    CFStringGetRangeOfComposedCharactersAtIndex = _libs['CoreFoundation'].CFStringGetRangeOfComposedCharactersAtIndex
    CFStringGetRangeOfComposedCharactersAtIndex.argtypes = [CFStringRef, CFIndex]
    CFStringGetRangeOfComposedCharactersAtIndex.restype = CFRange

if hasattr(_libs['CoreFoundation'], 'CFStringFindCharacterFromSet'):
    CFStringFindCharacterFromSet = _libs['CoreFoundation'].CFStringFindCharacterFromSet
    CFStringFindCharacterFromSet.argtypes = [CFStringRef, CFCharacterSetRef, CFRange, CFOptionFlags, POINTER(CFRange)]
    CFStringFindCharacterFromSet.restype = Boolean

if hasattr(_libs['CoreFoundation'], 'CFStringGetLineBounds'):
    CFStringGetLineBounds = _libs['CoreFoundation'].CFStringGetLineBounds
    CFStringGetLineBounds.argtypes = [CFStringRef, CFRange, POINTER(CFIndex), POINTER(CFIndex), POINTER(CFIndex)]
    CFStringGetLineBounds.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringGetParagraphBounds'):
    CFStringGetParagraphBounds = _libs['CoreFoundation'].CFStringGetParagraphBounds
    CFStringGetParagraphBounds.argtypes = [CFStringRef, CFRange, POINTER(CFIndex), POINTER(CFIndex), POINTER(CFIndex)]
    CFStringGetParagraphBounds.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringCreateByCombiningStrings'):
    CFStringCreateByCombiningStrings = _libs['CoreFoundation'].CFStringCreateByCombiningStrings
    CFStringCreateByCombiningStrings.argtypes = [CFAllocatorRef, CFArrayRef, CFStringRef]
    CFStringCreateByCombiningStrings.restype = CFStringRef

if hasattr(_libs['CoreFoundation'], 'CFStringCreateArrayBySeparatingStrings'):
    CFStringCreateArrayBySeparatingStrings = _libs['CoreFoundation'].CFStringCreateArrayBySeparatingStrings
    CFStringCreateArrayBySeparatingStrings.argtypes = [CFAllocatorRef, CFStringRef, CFStringRef]
    CFStringCreateArrayBySeparatingStrings.restype = CFArrayRef

if hasattr(_libs['CoreFoundation'], 'CFStringGetIntValue'):
    CFStringGetIntValue = _libs['CoreFoundation'].CFStringGetIntValue
    CFStringGetIntValue.argtypes = [CFStringRef]
    CFStringGetIntValue.restype = SInt32

if hasattr(_libs['CoreFoundation'], 'CFStringGetDoubleValue'):
    CFStringGetDoubleValue = _libs['CoreFoundation'].CFStringGetDoubleValue
    CFStringGetDoubleValue.argtypes = [CFStringRef]
    CFStringGetDoubleValue.restype = c_double

if hasattr(_libs['CoreFoundation'], 'CFStringAppend'):
    CFStringAppend = _libs['CoreFoundation'].CFStringAppend
    CFStringAppend.argtypes = [CFMutableStringRef, CFStringRef]
    CFStringAppend.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringAppendCharacters'):
    CFStringAppendCharacters = _libs['CoreFoundation'].CFStringAppendCharacters
    CFStringAppendCharacters.argtypes = [CFMutableStringRef, POINTER(UniChar), CFIndex]
    CFStringAppendCharacters.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringAppendPascalString'):
    CFStringAppendPascalString = _libs['CoreFoundation'].CFStringAppendPascalString
    CFStringAppendPascalString.argtypes = [CFMutableStringRef, ConstStr255Param, CFStringEncoding]
    CFStringAppendPascalString.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringAppendCString'):
    CFStringAppendCString = _libs['CoreFoundation'].CFStringAppendCString
    CFStringAppendCString.argtypes = [CFMutableStringRef, String, CFStringEncoding]
    CFStringAppendCString.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringAppendFormat'):
    _func = _libs['CoreFoundation'].CFStringAppendFormat
    _restype = None
    _argtypes = [CFMutableStringRef, CFDictionaryRef, CFStringRef]
    CFStringAppendFormat = _variadic_function(_func,_restype,_argtypes)

if hasattr(_libs['CoreFoundation'], 'CFStringAppendFormatAndArguments'):
    CFStringAppendFormatAndArguments = _libs['CoreFoundation'].CFStringAppendFormatAndArguments
    CFStringAppendFormatAndArguments.argtypes = [CFMutableStringRef, CFDictionaryRef, CFStringRef, c_void_p]
    CFStringAppendFormatAndArguments.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringInsert'):
    CFStringInsert = _libs['CoreFoundation'].CFStringInsert
    CFStringInsert.argtypes = [CFMutableStringRef, CFIndex, CFStringRef]
    CFStringInsert.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringDelete'):
    CFStringDelete = _libs['CoreFoundation'].CFStringDelete
    CFStringDelete.argtypes = [CFMutableStringRef, CFRange]
    CFStringDelete.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringReplace'):
    CFStringReplace = _libs['CoreFoundation'].CFStringReplace
    CFStringReplace.argtypes = [CFMutableStringRef, CFRange, CFStringRef]
    CFStringReplace.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringReplaceAll'):
    CFStringReplaceAll = _libs['CoreFoundation'].CFStringReplaceAll
    CFStringReplaceAll.argtypes = [CFMutableStringRef, CFStringRef]
    CFStringReplaceAll.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringFindAndReplace'):
    CFStringFindAndReplace = _libs['CoreFoundation'].CFStringFindAndReplace
    CFStringFindAndReplace.argtypes = [CFMutableStringRef, CFStringRef, CFStringRef, CFRange, CFOptionFlags]
    CFStringFindAndReplace.restype = CFIndex

if hasattr(_libs['CoreFoundation'], 'CFStringSetExternalCharactersNoCopy'):
    CFStringSetExternalCharactersNoCopy = _libs['CoreFoundation'].CFStringSetExternalCharactersNoCopy
    CFStringSetExternalCharactersNoCopy.argtypes = [CFMutableStringRef, POINTER(UniChar), CFIndex, CFIndex]
    CFStringSetExternalCharactersNoCopy.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringPad'):
    CFStringPad = _libs['CoreFoundation'].CFStringPad
    CFStringPad.argtypes = [CFMutableStringRef, CFStringRef, CFIndex, CFIndex]
    CFStringPad.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringTrim'):
    CFStringTrim = _libs['CoreFoundation'].CFStringTrim
    CFStringTrim.argtypes = [CFMutableStringRef, CFStringRef]
    CFStringTrim.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringTrimWhitespace'):
    CFStringTrimWhitespace = _libs['CoreFoundation'].CFStringTrimWhitespace
    CFStringTrimWhitespace.argtypes = [CFMutableStringRef]
    CFStringTrimWhitespace.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringLowercase'):
    CFStringLowercase = _libs['CoreFoundation'].CFStringLowercase
    CFStringLowercase.argtypes = [CFMutableStringRef, CFLocaleRef]
    CFStringLowercase.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringUppercase'):
    CFStringUppercase = _libs['CoreFoundation'].CFStringUppercase
    CFStringUppercase.argtypes = [CFMutableStringRef, CFLocaleRef]
    CFStringUppercase.restype = None

if hasattr(_libs['CoreFoundation'], 'CFStringCapitalize'):
    CFStringCapitalize = _libs['CoreFoundation'].CFStringCapitalize
    CFStringCapitalize.argtypes = [CFMutableStringRef, CFLocaleRef]
    CFStringCapitalize.restype = None

enum_anon_11 = c_int

kCFStringNormalizationFormD = 0 

kCFStringNormalizationFormKD = (kCFStringNormalizationFormD + 1) 

kCFStringNormalizationFormC = (kCFStringNormalizationFormKD + 1)

kCFStringNormalizationFormKC = (kCFStringNormalizationFormC + 1) 

CFStringNormalizationForm = CFIndex


if hasattr(_libs['CoreFoundation'], 'CFStringNormalize'):
    CFStringNormalize = _libs['CoreFoundation'].CFStringNormalize
    CFStringNormalize.argtypes = [CFMutableStringRef, CFStringNormalizationForm]
    CFStringNormalize.restype = None


if hasattr(_libs['CoreFoundation'], 'CFStringFold'):
    CFStringFold = _libs['CoreFoundation'].CFStringFold
    CFStringFold.argtypes = [CFMutableStringRef, CFOptionFlags, CFLocaleRef]
    CFStringFold.restype = None


if hasattr(_libs['CoreFoundation'], 'CFStringTransform'):
    CFStringTransform = _libs['CoreFoundation'].CFStringTransform
    CFStringTransform.argtypes = [CFMutableStringRef, POINTER(CFRange), CFStringRef, Boolean]
    CFStringTransform.restype = Boolean


try:
    kCFStringTransformStripCombiningMarks = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformStripCombiningMarks')
except:
    pass


try:
    kCFStringTransformToLatin = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformToLatin')
except:
    pass


try:
    kCFStringTransformFullwidthHalfwidth = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformFullwidthHalfwidth')
except:
    pass


try:
    kCFStringTransformLatinKatakana = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinKatakana')
except:
    pass


try:
    kCFStringTransformLatinHiragana = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinHiragana')
except:
    pass


try:
    kCFStringTransformHiraganaKatakana = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformHiraganaKatakana')
except:
    pass


try:
    kCFStringTransformMandarinLatin = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformMandarinLatin')
except:
    pass


try:
    kCFStringTransformLatinHangul = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinHangul')
except:
    pass


try:
    kCFStringTransformLatinArabic = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinArabic')
except:
    pass


try:
    kCFStringTransformLatinHebrew = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinHebrew')
except:
    pass


try:
    kCFStringTransformLatinThai = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinThai')
except:
    pass


try:
    kCFStringTransformLatinCyrillic = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinCyrillic')
except:
    pass


try:
    kCFStringTransformLatinGreek = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformLatinGreek')
except:
    pass


try:
    kCFStringTransformToXMLHex = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformToXMLHex')
except:
    pass


try:
    kCFStringTransformToUnicodeName = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformToUnicodeName')
except:
    pass


try:
    kCFStringTransformStripDiacritics = (CFStringRef).in_dll(_libs['CoreFoundation'], 'kCFStringTransformStripDiacritics')
except:
    pass


if hasattr(_libs['CoreFoundation'], 'CFStringIsEncodingAvailable'):
    CFStringIsEncodingAvailable = _libs['CoreFoundation'].CFStringIsEncodingAvailable
    CFStringIsEncodingAvailable.argtypes = [CFStringEncoding]
    CFStringIsEncodingAvailable.restype = Boolean


if hasattr(_libs['CoreFoundation'], 'CFStringGetListOfAvailableEncodings'):
    CFStringGetListOfAvailableEncodings = _libs['CoreFoundation'].CFStringGetListOfAvailableEncodings
    CFStringGetListOfAvailableEncodings.argtypes = []
    CFStringGetListOfAvailableEncodings.restype = POINTER(CFStringEncoding)


if hasattr(_libs['CoreFoundation'], 'CFStringGetNameOfEncoding'):
    CFStringGetNameOfEncoding = _libs['CoreFoundation'].CFStringGetNameOfEncoding
    CFStringGetNameOfEncoding.argtypes = [CFStringEncoding]
    CFStringGetNameOfEncoding.restype = CFStringRef


if hasattr(_libs['CoreFoundation'], 'CFStringConvertEncodingToNSStringEncoding'):
    CFStringConvertEncodingToNSStringEncoding = _libs['CoreFoundation'].CFStringConvertEncodingToNSStringEncoding
    CFStringConvertEncodingToNSStringEncoding.argtypes = [CFStringEncoding]
    CFStringConvertEncodingToNSStringEncoding.restype = c_ulong


if hasattr(_libs['CoreFoundation'], 'CFStringConvertNSStringEncodingToEncoding'):
    CFStringConvertNSStringEncodingToEncoding = _libs['CoreFoundation'].CFStringConvertNSStringEncodingToEncoding
    CFStringConvertNSStringEncodingToEncoding.argtypes = [c_ulong]
    CFStringConvertNSStringEncodingToEncoding.restype = CFStringEncoding


if hasattr(_libs['CoreFoundation'], 'CFStringConvertEncodingToWindowsCodepage'):
    CFStringConvertEncodingToWindowsCodepage = _libs['CoreFoundation'].CFStringConvertEncodingToWindowsCodepage
    CFStringConvertEncodingToWindowsCodepage.argtypes = [CFStringEncoding]
    CFStringConvertEncodingToWindowsCodepage.restype = UInt32


if hasattr(_libs['CoreFoundation'], 'CFStringConvertWindowsCodepageToEncoding'):
    CFStringConvertWindowsCodepageToEncoding = _libs['CoreFoundation'].CFStringConvertWindowsCodepageToEncoding
    CFStringConvertWindowsCodepageToEncoding.argtypes = [UInt32]
    CFStringConvertWindowsCodepageToEncoding.restype = CFStringEncoding


if hasattr(_libs['CoreFoundation'], 'CFStringConvertIANACharSetNameToEncoding'):
    CFStringConvertIANACharSetNameToEncoding = _libs['CoreFoundation'].CFStringConvertIANACharSetNameToEncoding
    CFStringConvertIANACharSetNameToEncoding.argtypes = [CFStringRef]
    CFStringConvertIANACharSetNameToEncoding.restype = CFStringEncoding


if hasattr(_libs['CoreFoundation'], 'CFStringConvertEncodingToIANACharSetName'):
    CFStringConvertEncodingToIANACharSetName = _libs['CoreFoundation'].CFStringConvertEncodingToIANACharSetName
    CFStringConvertEncodingToIANACharSetName.argtypes = [CFStringEncoding]
    CFStringConvertEncodingToIANACharSetName.restype = CFStringRef


if hasattr(_libs['CoreFoundation'], 'CFStringGetMostCompatibleMacStringEncoding'):
    CFStringGetMostCompatibleMacStringEncoding = _libs['CoreFoundation'].CFStringGetMostCompatibleMacStringEncoding
    CFStringGetMostCompatibleMacStringEncoding.argtypes = [CFStringEncoding]
    CFStringGetMostCompatibleMacStringEncoding.restype = CFStringEncoding


class struct_anon_12(Structure):
    pass

struct_anon_12.__slots__ = [
    'buffer',
    'theString',
    'directBuffer',
    'rangeToBuffer',
    'bufferedRangeStart',
    'bufferedRangeEnd',
]
struct_anon_12._fields_ = [
    ('buffer', UniChar * 64),
    ('theString', CFStringRef),
    ('directBuffer', POINTER(UniChar)),
    ('rangeToBuffer', CFRange),
    ('bufferedRangeStart', CFIndex),
    ('bufferedRangeEnd', CFIndex),
]

CFStringInlineBuffer = struct_anon_12 


if hasattr(_libs['CoreFoundation'], 'CFShow'):
    CFShow = _libs['CoreFoundation'].CFShow
    CFShow.argtypes = [CFTypeRef]
    CFShow.restype = None


if hasattr(_libs['CoreFoundation'], 'CFShowStr'):
    CFShowStr = _libs['CoreFoundation'].CFShowStr
    CFShowStr.argtypes = [CFStringRef]
    CFShowStr.restype = None


if hasattr(_libs['CoreFoundation'], '__CFStringMakeConstantString'):
    __CFStringMakeConstantString = _libs['CoreFoundation'].__CFStringMakeConstantString
    __CFStringMakeConstantString.argtypes = [String]
    __CFStringMakeConstantString.restype = CFStringRef


try:
    __COREFOUNDATION_CFSTRING__ = 1
except:
    pass


try:
    kCFStringEncodingInvalidId = 4294967295L
except:
    pass


def CFSTR(cStr):
    return (__CFStringMakeConstantString ((('' + cStr) + '')))


try:
    __kCFStringInlineBufferLength = 64
except:
    pass


def CFStringGetCharacterFromInlineBuffer(buf, idx):
    return ((idx < 0) or (idx >= ((((buf.contents.rangeToBuffer).value).length).value))) and 0 or (buf.contents.directBuffer) and ((buf.contents.directBuffer) [(idx + ((((buf.contents.rangeToBuffer).value).location).value))]) or (CFStringGetCharacterAtIndex ((buf.contents.theString), (idx + ((((buf.contents.rangeToBuffer).value).location).value))))



